package cn.wx.scholar;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;

import org.apache.commons.lang.StringUtils;
import com.csvreader.CsvReader;

import cn.wx.common.utils.JSONUtils;

public class ReadCsv {

	
	public static void main(String[] args) {
		
		final String filePath = "E:\\my_read_csv\\org.csv";
		try {
			
			CsvReader csvReader = new CsvReader(filePath);
			
			// 读表头
            csvReader.readHeaders();
            int i = 0;
            while (csvReader.readRecord()){
                // 读一整行
            	String line = csvReader.getRawRecord();
				if(StringUtils.isBlank(line)) {
					continue;
				}

				/**
				 * 解析csv
				 */
				String fId = csvReader.get(0);
				String ecount = csvReader.get(1);
				
				
				System.out.println(Long.valueOf(fId) + " : " + Integer.parseInt(ecount));
            }

            /**
			 * 关闭读入流
			 */
			csvReader.close();
			csvReader = null;
            
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

}
